package com.acme.orders.model;

import java.io.Serializable;
import java.util.List;

public class Product implements Serializable {
	
	private static final long serialVersionUID = 7862732506342688678L;
	
	private String id;
	private String description;
	private List<Category> categories;

	public String getId() {
		return id;
	}
	public String getDescription() {
		return description;
	}
	public List<Category> getCategories() {
		return categories;
	}

	public Product setId(String id) {
		this.id = id;
		return this;
	}
	public Product setDescription(String description) {
		this.description = description;
		return this;
	}
	public Product setCategories(List<Category> categories) {
		this.categories = categories;
		return this;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Product other = (Product) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Product [");
		if (id != null)
			builder.append(id).append("| ");
		if (description != null)
			builder.append(description);
		builder.append("]");
		return builder.toString();
	}
		
	
} 
